<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Week
 *
 * @author Phuong Vu
 */
class Lesson {
    //put your code here
    public $ID;
    public $ID_Week;
    public $Name;
    public $Image;
    public $SubjectWriting;
    
//    
//    public function GetListLesson(){
//       $con = mysql_connect("localhost","phuongvu102","phuongvu102");
//        if (!$con)
//        {
//            die('Could not connect: ' . mysql_error());
//        }
//
//        mysql_select_db("languagelearning", $con);
//
//        $result = mysql_query("SELECT * FROM lesson");
//        return $result;
//   }
   
   
       function getSubjectWritingByIDLesson($idLesson) {
        try {
            $connection = new MySqlDataAccessHelper();
            $connection->open();
            $lesson = new Lesson() ;
            $sql = "select * from lesson where ID = $idLesson";
            $result = $connection->executeQuery($sql);
            
            while ($row = mysql_fetch_object($result)) {
                $lesson =$row;
            }
            
            $connection->close();
            return $lesson;
            
        } catch (Exception $e) {
            $connection->close();
            return false;
        }
    }
}



?>
